//保存
function save() {

    //用户等级
    if($("#userLevel").val() == "") {
        $("#userLevel").tips({
            side: 3,
            msg: '输入用户等级',
            bg: '#AE81FF',
            time: 2
        });
        $("#userLevel").focus();
        return false;
    }else if(!$.fn.isPositiveInteger($("#userLevel").val())){
        $("#userLevel").tips({
            side:3,
            msg:'用户等级应为正整数',
            bg:'#AE81FF',
            time:2
        });
        $("#userLevel").focus();
        return false;
    }else{
        $("#userLevel").val($.trim($("#userLevel").val()));
    }

    $("#form").submit();
    $("#zhongxin").hide();
    $("#zhongxin2").show();
}

$(function() {
    //下拉框
    if(!ace.vars['touch']) {
        $('.chosen-select').chosen({allow_single_deselect:true});
        $(window)
            .off('resize.chosen')
            .on('resize.chosen', function() {
                $('.chosen-select').each(function() {
                    var $this = $(this);
                    $this.next().css({'width': $this.parent().width()});
                });
            }).trigger('resize.chosen');
        $(document).on('settings.ace.chosen', function(e, event_name, event_val) {
            if(event_name != 'sidebar_collapsed') return;
            $('.chosen-select').each(function() {
                var $this = $(this);
                $this.next().css({'width': $this.parent().width()});
            });
        });
        $('#chosen-multiple-style .btn').on('click', function(e){
            var target = $(this).find('input[type=radio]');
            var which = parseInt(target.val());
            if(which == 2) $('#form-field-select-4').addClass('tag-input-style');
            else $('#form-field-select-4').removeClass('tag-input-style');
        });
    }
});